\section{Homological Algebra}
Homological algebra tries to find invariants to tell spaces apart from each
other. We start with a motivation of the topic.
\begin{Example}
Let $R$ be a ring and $(R-mod)$ be the category of $R$-modules.
If $\phi: M\rightarrow N$, then one may speak of
\begin{itemize}
  \item $Ker \phi\subset M$
  \item $Im \phi \subset N$
  \item $Coker \phi=N/Im\phi)$
\end{itemize}
So it makes sense to speak of exact sequences
$$\xymatrix{
L \ar[r]^{\alpha} & M \ar[r]^{\beta} & N
}$$ exact at $M$ if $Im(\alpha)=Ker(\beta)$.

($R$-Mod) is an instance of an abelian category.
\end{Example}

\begin{definition}[Exact Functor]
Let $\FF: (R$-$Mod)\rightarrow (Abelian Groups)$ be a functor into the
category of abelian groups. $\FF$ is exact if for any short exact sequence in
($R$-Mod) $$\xymatrix{
0\ar[r] & L \ar[r] & M \ar[r] & N \ar[r] & 0
}$$ 
also 
$$\xymatrix{
0\ar[r] & \FF(L) \ar[r] & \FF(M) \ar[r] & \FF(N) \ar[r] & 0
}$$ is exact in the category $(Ab. Groups)$.
\end{definition} 

\begin{Example}
\begin{itemize}
  \item Localization is an exact functor.

\item Fix $D\in (R$-$Mod)$ and consider
the functor $\FF_D(A)=Hom_R(D,A)$.
Now if 
$$\xymatrix{
0\ar[r] & A \ar[r] & B \ar[r] & C \ar[r] & 0
}$$ is exact then 

$$\xymatrix{
0\ar[r] & Hom_R(D,A) \ar[r] & Hom_R(D,B) \ar[r] & Hom_R(D,C) \ 
}$$ is exact.
But you cannot add 

We give an example which shows that  $\rightarrow 0$ cannot be added at the end
in general.
$$\xymatrix{
0\ar[r] & \ZZ \ar[r]^{\cd n} & \ZZ \ar[r] & \ZZ/n\ZZ \ar[r] & 0\\
 & & D=\ZZ/n\ZZ \ar@{.>}[u] \ar[ur]^{id} 
}$$
The dotted arrow does not exist.
\end{itemize}
\end{Example}

\begin{definition}[Projective Module]
A $R$-module $D$ is projetive if $Hom_R(D,-)$ is exact.
\end{definition}
\begin{lemma}
An $R$-module $D$ projective iff $D$ is a direct summand of a free $R$-module
$\FF$, i.e.
$F\cong D\oplus D'$.
\end{lemma}
\begin{proof} We only show one direction of the proof. The other one is left as
exercise.
\begin{itemize}
  \item[$\Rightarrow$] Let $\{d_i \mid i\in I\}$ be a set of gernerators of $D$.
  Then $F=R^I\rightarrow D\rightarrow 0$.
  So we have
  $$\xymatrix{
0\ar[r] & D' \ar[r] & F \ar[r] & D \ar[r] & 0\\
 & Ker(\alpha) \ar@{=}[u]& D \ar@{.>}[u]^{\beta} \ar@{.>}[ur]^{id} 
}$$
Since $D$ is projective, there exists $\beta: D\rightarrow F$, s.t. $\alpha
\circ \beta=id$. So $\beta$ is injective and $F\cong D'\oplus Im (\beta)=D'\oplus D$.
\end{itemize}
\end{proof}

Similarily consider the functor 
$Hom_R(-,D): (R$-$Mod)\rightarrow (Abelian Groups)$. This is a contravariant
functor, i.e. if $A\rightarrow B\rightarrow D$, then \mbox{$Hom_R(B,D)\rightarrow
Hom_R(A,D)$}.

If 
$$\xymatrix{
0\ar[r] & A\ar[r] & B \ar[r] & C \ar[r] & 0
}$$ is exact then get
$$\xymatrix{
0\ar[r] & Hom_R(C,D) \ar[r] & Hom_R(B,D) \ar[r] & Hom_R(A,D)
}$$ is exact and again $\rightarrow 0$ cannot be added at the end in general.

\begin{definition}[injective, left exact]
$D$ is injective $Hom_R(-,D)$ is exact. 

The functors $Hom_R(D,-)$ and
$Hom_R(-,D)$ are said to be left exact.
\end{definition}

 \begin{Example}
 
An example of a right exact functor is $-\otimes_R D: (R$-$mod)\rightarrow
(Abelian Groups)$.
If $$\xymatrix{
0\ar[r] & A\ar[r] & B \ar[r] & C \ar[r] & 0
}$$ is exact,then 
$$\xymatrix{
A\otimes_R D \ar[r] & B \otimes_R D\ar[r] & C\otimes_R D \ar[r] & 0
}$$ is exact.
\end{Example}

\textbf{Motivation:}
Let $\FF: (R$-$Mod)\rightarrow (Abelian Groups)$ be a left exact functor.
and consider the exact sequence
$$\xymatrix{
0\ar[r] & A\ar[r] & B \ar[r] & C \ar[r] & 0
}$$
and its sequence under $\FF$
$$\xymatrix{
0\ar[r] & \FF(A)\ar[r] & \FF(B) \ar[r] & \FF(C) 
}$$
The goal of homological algebra is to answer the question whether one can
continue this exact sequence to a long exact sequence?

\subsection{Algebraic Preliminaries}
We work in the category of $(R$-$Modules)$.
\begin{definition}[Complex]
Let $(C,d)$ be a sequence of $R$-$mod$ homomorphisms
$$\xymatrix{
0\ar[r] & C^{-1}\ar[r] & C^0 \ar[r]^{d_0} & C^1 \ar[r]^{d_1} & C^2
\ar[r]^{d_2} & \ldots}$$

\begin{enumerate}[i)]
\item Say that $(C,d)$ is a complex if $d_i\circ d_{i-1}=0~\forall i$,i.e. $Im
(d_{i-1}\subseteq Ker d_i)~ \forall i$.

\item If $(C,d)$ is a complex the nth cohomology group of $(C,d)$
is $H^n(C)=Ker(d_{n+1}/Im(d_n)$.
\end{enumerate}
\end{definition}
Note that $(C,d)$ is exact iff $H^n(C)=0~\forall n$.

\begin{definition}[Category of Complexes]
If $(A)$ and $(B)$ are two complexes,  a morphism 
$\phi\com: A\com\rightarrow B\com$ is a family of hommorphisms
$\phi^n: A^n\rightarrow B^n$ s.t.

$$\xymatrix{
\ar[r] &  A^{n-1} \ar[r] \ar[d]_{\phi^{n-1}}& A^n \ar[r] \ar[d]_{\phi^{n}} &
A^{n+1} \ar[r] \ar[d]_{\phi^{n+1}}&
\cdots
\\
\ar[r] &  B^{n-1} \ar[r] & B^n \ar[r] & B^{n+1} \ar[r] & \cdots 
}$$
commutes.
Given $\phi\com: A\com\rightarrow B\com$
$Ker (\phi\com)$ is the subcomplex of $A\com$.
$Ker(\phi)^n=Ker(\phi^n)$.
$$
\xymatrix{
\ar[r] & Ker \phi^n\ar[r]^{d_A^n} \ar[d]^{\subseteq} & Ker \phi^{n+1} \ar[r] 
\ar[d]^{\subseteq}  & \cdots
\\
\ar[r] & A^n\ar[r]^{d_A^n} & A^{n+1}\ar[r]& \cdots
}
$$
Similarily we have
$Im(\phi)^n= Im(\phi^n)$ a subcomplex of $B\com$.
$(Coker \phi)^n=B^n /Im(\phi^n)$.
Hence, we can talk of exact sequences of complexes.
\end{definition}
In the following we want to show that 
$H^n: \{Complexes\}\rightarrow \{Abelian Groups\}$.
is a functor.
 If $\phi\com: A\com\rightarrow B\com$ is a morphism of
complexes we will get \mbox{$H^n(\phi\com): H^n(A\com)\rightarrow H^n(B\com)$}.
\begin{prop}
$\phi\com: A\com\rightarrow B\com$ induces $H^n(\phi\com): H^n(A\com)\rightarrow
H(B\com)$.

 If 
$$\xymatrix{
A\com \ar[r]^{\alpha} & B\com \ar[r]^{\beta} & C\com 
}$$
then 
$H^n(\beta\circ \alpha)=H^n(\beta)\circ H^n(\alpha)$, i.e. $H^n$ is a functor
from $(Complexes)$ to $(Abelian Groups)$.
\end{prop}
\begin{proof}
Given $[a_n]\in H^n(A\com)=Ker(d^{n+1}_A)/Im(d^n_A)$
with $a_n\in Ker (d_{n+1})$ and we want to define
$H^n(\phi([a_n])=\phi^n(a_n)]$.

\textbf{Question:} 
\begin{itemize}
  \item Is $\phi^n(a_n)\in Ker d_B^{n+1}$? Yes.
  \item Does this depend on choice of $a_n$? No.
  
  If you pick $a_n'\in A^n$ s.t. $d_A^{n+1}(a_n')=0$ and $a_n-a_n'\in Im d_A^n)$
 . If $a_n-a_n'=d_A^n(a_{n-1}$. Then
 $\phi^n(a_n-a_n')=\phi^n(d_A^n(a_{n-1}))=d^n_B\phi^{n-1}(a_{n-1})$. So indeed
 $phi^n(a_n-a_n')\in Im(d_B^n)$.
\item Is $H^n(\phi)$ a group homomorphism (as $R$-module homomorphism)?  Yes
\end{itemize}
$$\xymatrix{
\ar[r] & A^{n-1} \ar[d]_{\phi^{n-1}} \ar[r] & A^{n} \ar[r] \ar[d]_{\phi^{n}} 
& A^{n+1} \ar[r]  \ar[d]_{\phi^{n+11}}  & \\
\ar[r] & B^{n-1} \ar[r] & B^{n} \ar[r] & B^{n+1} \ar[r] & 
}$$
\end{proof}



\begin{thm}[Long Exact Sequence in Cohomology]
Let
$$\xymatrix{
0\ar[r] & A\com\ar[r] & B\com \ar[r] & C\com \ar[r] & 0
}$$ be a short exact sequence of complexes, i.e.
$$\xymatrix{
0\ar[r] & A^n\ar[r] & B^n \ar[r] & C^n \ar[r] & 0
}$$ is exact for all $n$.

Then there is a long exact sequence

$$\xymatrix{
\ldots\ar[r] & H^{n-1}(A\com) \ar[r] &  H^n(B\com)\ar[r] &
H^n(C\com)\ar[r]^{\delta^{n+1}} & H^{n+1}(A\com) \ar[r] & \ldots },$$
where $\delta^{n+1}$ is defined by \ldots

\end{thm}
\begin{proof}
\begin{itemize} Most proofs chase around elements in the following diagram.
  $$\xymatrix{
&\ar[d] &\ar[d] & \ar[d] &\\
0 \ar[r]& A^{n-1} \ar[r]^{\alpha^{n-1}} \ar[d]_{d_A^{n-1}} & B^{n-1}
\ar[r]^{\beta^{n-1}} \ar[d]^{d_B^{n-1}}& C^n \ar[r] \ar[d]^{d_C^{n-1}} & 0\\
0 \ar[r]& A^{n} \ar[r]^{\alpha^n} \ar[d]_{d_A^{n}} & B^{n} \ar[r]^{\beta^n}
\ar[d]^{d_B^{n}}& C^n \ar[r] \ar[d]^{d_C^{n}}& 0\\
0\ar[r] & A^{n+1} \ar[r]^{\alpha^{n+1}} \ar[d]_{d_A^{n+1}} & B^{n+1}
\ar[r]^{\beta^{n+1}} \ar[d]^{d_B^{n-1}}& C^n \ar[r] \ar[d]^{d_C^{n+1}}& 0\\
& & & & 
}$$
  \item \textbf{Exactness at $H^n(B\com)$B:} 

By the previous Proposition we know that in  
$$\xymatrix{
H^n(A\com) \ar[r]^{H^n(\alpha\com)} & H^n(B\com) \ar[r]^{H^n(\beta\com)} & C^n
}$$ $H^n(\beta\com) \circ H^n(\alpha\com)$ has composite zero.

We want to show that $Ker(H^n(\beta\com))=Im (H^n(\alpha\com))$
Let $[b_n]\in H^n(\beta\com)$ s.t. 
$\beta^n(b_n)\in Im d_C^n$. We need to find $a_n\in A^n$ 
s.t.
\begin{itemize}
  \item $a_n\in Ker d_A^{n+1}$.
  \item $\alpha^n(a_n)=b_n mod Im d_B^n$
\end{itemize}
These properties can be proved by chasing around elements in the above
diagram.

\item \textbf{Exactness at $H^n(C)$:}
 One also has to chase around elements.
\end{itemize}
\end{proof}

\begin{center}
\textbf{Lecture 09.03.2012}
\end{center}

\begin{thm}[Snake Lemma]
$$
\xymatrix{
& A \ar[r] \ar[d]^{\alpha} & B \ar[r] \ar[d]^{\beta}& C\ar[r] \ar[d]^{\gamma}&
= \\
0 \ar[r] & A' \ar[r] & \ar[r]B' & \ar[r] C' & 0
}
$$
Given the above commutative diaagram of $R$-modules. with exact rows. Then one
get an exact sequence as follows.

$$\xymatrix{
Ker(\alpha)\ar[r] & Ker(\beta) \ar[r] & Ker(\gamma) \ar[r]^{\delta} &
Coker(\alpha) \ar[r]& Coker(\beta)
\ar[r] & Coker(\gamma)
\ar[r] & 0
}$$
\end{thm}
\begin{proof}
Homework 4.
\end{proof}

Comes from topology. If two topologic spaces are homotop to each other the
invariants will be the same.
\begin{definition}[Homotopy]
If $\alpha\com, \beta\com: A\com \rightarrow B\com$ are two maps of complexes
inducing $H^n(\alpha\com), H^n(\beta\com): H^n(A\com)\rightarrow H^n(B\com)$
then it is possible that 
$H^n(\alpha\com)=H^n(\beta\com)~\forall n$
even if $\alpha\com\neq \beta\com$.

$\alpha\com$ is homotopic to $\beta\com$ if there exists $S_n:A{n+1}\rightarrow
B^n$
$$
\xymatrix{
\ldots \ar[r] & A^{n-1} \ar[r]^{d_A^n} & A^n \ar[dl]_{S^{n-1}}\ar[r]^{d_A^{n+1}}
\ar@/^/[d]^{\alpha^n}\ar@/_/[d]^{\beta^n}& A^{n+1} \ar[dl]_{S^{n}} \ar[r] &
\ldots \\
\ldots \ar[r] & B^{n-1} \ar[r]^{d_B^n} & B^n \ar[r]^{d_B^{n+1}} & B^{n+1} \ar[r]
& \ldots
}
$$

$\alpha^n-\beta^n=d_B^n\circ S_{n-1}+S_n\circ d_A^{n+1}$ $\forall n$. 

\end{definition}

\begin{lemma}
Homotopy is an equivalence relation.
\end{lemma}
\begin{prop}
If $\alpha\com$ is homotopic to $\beta\com$, then each
$H^n(\alpha\com)=H^n(\beta\com)~\forall n$
\end{prop}
\begin{proof}
If $[a_n]\in H^n(A\com)$, then $H^n(\alpha\com)([a_n])=[\alpha^n(a_n)]$
$H^n(\beta\com)([a_n])=[\beta^n(a_n)]$ and hence
$\alpha^n(a_n)-\beta^n(a_n)\in Im d_B^n$.
\end{proof}

\textbf{Last Time:} If $\alpha\com$ is homotopic to $0$ (zero map), say
$\alpha\com$ is null-homotopic in which case $H^n(\alpha\com)\equiv 0$.

\subsection{End of Algebraic Prelimiries}
We had to deal with the failure of exactness of $Hom_R(-,D)$.
$$\xymatrix{
0\ar[r] & A\ar[r] & B\ar[r] & C\ar[r] & 0
}$$ exact we have

$$\xymatrix{
0\ar[r] & Hom_R(C,D) \ar[r] & Hom_R(B,D) \ar[r] & Hom_R(A,D)\ar[r] & 0
}$$

$Hom_R(-,D)$ is exact iff $D$ is injective.

\textbf{Goal:} We would like to find a family of contravariant functors $T_n:
(R-Mod)\rightarrow (Abelian Groups)$, $n\geq 0$ such that
\begin{itemize}
  \item $T_0=Hom_R(-,D)$
  \item for every short exact sequence 
  $$
 \xymatrix{
0\ar[r] & A\ar[r] & B\ar[r] & C\ar[r] & 0
}$$
you get a long exact sequence 
$$\xymatrix{
0\ar[r] & T_0(C) \ar[r] & T_0(B) \ar[r] & T_0(A)\ar[r]^{\delta_0} & T_1(C)
\ar[r] & T_1(B) \ar[r] & \cdots }$$  
   
\end{itemize}

If you have two short exact sequences
 $$\xymatrix{
0\ar[r] & A\ar[r] \ar[d]& B\ar[r] \ar[d]& C\ar[r]\ar[d] & 0\\
0\ar[r] & A'\ar[r] & B'\ar[r] & C'\ar[r] & 0
}$$
is a commutative with exact rows 
then the following is commutative
$$\xymatrix{
0\ar[r] & T_0(C) \ar[r] & T_0(B) \ar[r] & T_0(A)\ar[r]^{\delta_0} & T_1(C)
\ar[r] & T_1(B) \ar[r] & \cdots\\
0\ar[r] & T_0(C') \ar[r] \ar[u]& T_0(B') \ar[r] \ar[u]& T_0(A')\ar[r]^{\delta_0}
\ar[u]& T_1(C') \ar[r] \ar[u]& T_1(B') \ar[r] \ar[u]& \cdots 
}$$  
\begin{definition}[$\delta$-functor]
Such a family $(T_n,\delta_n)$ is called a $\delta$-functor associated to
$T_0=Hom_R(-,D)$.

\end{definition}
 A $\delta$-functor  $(T_n,\delta_n)$ is universal if given any other
 $\delta$-functor $(T_n',\delta_n')$, there exists a unique natural
 transformation
 $T_n\rightarrow T_n'$.
 
 \begin{definition}[projective resolution]
 A projective resolution of $A$ is an exact sequence
   $$
 \xymatrix{
\ldots\ar[r] & P_2\ar[r] & P_1\ar[r] & P_0\ar[r]^{\epsilon_A} & A \ar[r] & 0
}$$
with $P_i$'s projective.
 \end{definition}
\begin{Example}
If $A$ is projective
$$
\xymatrix{
0 \ar[r] & A \ar[r]^{id} & A \ar[r] & 0 \\
P_1 \ar@{=}[u] & P_0 \ar@{=}[u] 
}
$$ is a projective resolution.
\end{Example}

\begin{lemma}
Every $A$ has a projective resolution.
\end{lemma}
\begin{proof}
Pick a set of generators $\{a_i\mid i\in I\}$ of $A$. Set $P_0=R^I$ - the free
$R$-module with basis $\{a_i \mid i\in I\}$
We have $P_0\stackrel{\epsilon_A}{\rightarrow}A\rightarrow 0$, $a_i\mapsto a_i$.
Let $\{b_j \mid j\in J\}$ be a set of generators of $Ker \epsilon_A$, set
$P_1=R^J$ Then
 $$\xymatrix{P_1\ar[r] & P_0\ar[r]^{\epsilon_A} & A \ar[r] & 0}$$
is exact. Etc $\ldots$
\end{proof}
The key definition.
\begin{definition}
For any $A$, pick a projective resolution
$P\com\rightarrow A\rightarrow 0$.
Apply $Hom_R(-,D)$
$$
\xymatrix{
0 \ar[r] & Hom_R(A,D) \ar[r] & Hom_R(P_0,D) \ar[r] & Hom_R(P_1,D) \ar[r] &
Hom_R(P_2,D) \ar[r] & \ldots} $$ is a complex, but it is exact at
$Hom_R(A,D)\rightarrow Hom_R(P_0,D)$

 Define 
 $$Ext_R^n(A,D)=H^n(Hom_R(P\com,D))$$
  which is the cohomology group of 
  $$
  \xymatrix{
  0\ar[r] & Hom_R(P_0,D) \ar[r] & Hom_R(P_1,D) \ar[r] & \ldots
  }
  $$
 Note that $Ext_R^0(A,D)=Hom_R\com(A,D)$

\textbf{Objections:} 
\begin{itemize}
  \item Does this depends on the choice of the projective resoultion?
  \item Is $A\mapsto Ext_R^n(A,D)$ a functor?
  \item Why define this? (Is this family a $\delta$-functor?)
  \end{itemize}
\end{definition}
\begin{lemma}
If 
$$
\xymatrix{
P\com \ar[r] \ar@{.>}[d]_{\exists f\com} & A \ar[r] \ar[d]^{f}& 0 \\
Q\com \ar[r]  & A' \ar[r] & 0
}
$$
are projective versions onf $A$ and $A'$ then  there exists $f\com:
P\com\rightarrow Q\com$ extending $f$.
\end{lemma}

What does projective mean?
$$
\xymatrix{
B \ar[r] & A \ar[r] & 0\\
& P \ar{.>}[ul]
}
$$
\begin{proof}
$$
\xymatrix{
P' \ar[r]^{d_P^0} & P\com \ar[r] \ar@{.>}[d]_{\exists f^{0\cd}} & A \ar[r]
\ar[d]^{f} & 0\\
Q' \ar[r]^{d_P^0} Q\com \ar[r]  & A' \ar[r] & 0
}
$$
consider $f\circ \epsilon_A: P^0\rightarrow A'$ since $P^0$ is projective, you
can lift this to $f^0: P^0\rightarrow Q^0$

Consider $f^0\circ d^0_P:P'\rightarrow Q^0$ and note that $Im f^0\circ
d_P^0\subset Im d_Q^0$. So get 
$$
\xymatrix{
P' \ar[d]_{\exists f'}  \ar[dr]^{f^0 \circ d^0_P}\\
Q'& Im d_Q^0 \ar[r] & 0
}$$
since $P'$ is projective, we get a lifting $f':P'\rightarrow Q'$,etc.

Note that we do not need $Q\com$ to be projective in this lemma.
\end{proof}

If 
$$\xymatrix{
P^{\cd '} \ar[r] \ar@{.>}[d]_{\exists f\com} & A \ar[r] \ar[d]^{f} & 0 \\
Q^{\cd '} \ar[r]  & A' \ar[r] & 0}$$
then we get:
$$
\xymatrix{
0 \ar[r] & Hom_R(A,D) \ar[r]^{\epsilon_A^*} & Hom_R(P,D) \\
0 \ar[r] & Hom_R(A',D) \ar[u]^{f^*}\ar[r]^{\epsilon_A^*} & Hom_R(Q',D)
\ar[u]_{f^*}
}
$$ and hence:
$$H^n(f^{\cd *}): Ext_R^n()A',D)\rightarrow Ext(n_R(A,D))$$
\begin{Example}
If $P\com \rightarrow A \rightarrow 0$ and $Q\com \rightarrow A\rightarrow 0$
are two projective resolutions.

$$
\xymatrix{
P\com \ar[r] \ar@{.>}[d]_{\exists f\com} & A \ar[r] \ar[d]^{id}& 0\\
Q\com \ar[r] \ar@{.>}[d]_{\exists f\com} & A \ar[r] \ar[d]^{id}& 0\\
P\com \ar[r] & A \ar[r]& 0\\
}
 $$
 
 which leads to:
 
  $$
\xymatrix{
H^n(Hom(P\com,D)) \\
H^n(Hom(Q\com,D)) \ar[u]^{H^n(f\com*)}\\
H^n(Hom(P\com,D)) \ar[u]^{H^n(g\com*)} \ar@/^/[uu] 
} $$
\end{Example}
\begin{lemma}
The induced map 
$H^n(f\com*): H^n(Hom_R(Q\com,D))\rightarrow H^n(Hom_R(P\com,D))$ depends only
on $f:A\rightarrow A'$ and not on the choice of liftings $f\com: P\com
\rightarrow Q\com$.
\end{lemma}
\begin{proof}
You may assume $f=0$ and then try to show that $H^n(f^{\cd '})=0$.
It suffices to find a homotopy $(S_n)$ between $f\com *$ and the zero map $0$.

$$
\xymatrix{
\ldots \ar[r] & Hom(Q^n,D)\ar[r] \ar[dl]^{t^n}& Hom(Q^{n+1},D)
\ar[dl]^{t^{n+1}}\\
\ldots \ar[r] & Hom(P^n,D)\ar[r]& Hom(P^{n+1},D)
}
$$
i.e. find $\{t_n\}$ such that $f^n*=d_P^n\circ t^n+ t^{n+1}\circ d_Q^{n+1}$.
It suffices to find $S_n$ given by the following picture
$$
\xymatrix{
P^{n+1}\ar[r]^{d_P^n}& P^n \ar[dl]^{s_{n+1}} ar[d]^{f^n} \ar[r]^{d_P^{n-1}} &
P^{n-1} \ar[dl]^{s_{n}} \ar[r] \ar[d]^{f^{n-1}}& \ar[dl]
\\
Q^{n+1}\ar[r]^{d_Q^n}& Q^n \ar[r]^{d_Q^{n-1}} & Q^{n-1} \ar[r] &
}
$$
such that $f^n=d_Q\circ S_{n+1}+S_n\circ d_P$.

Assume inductively that we have found $S_n$, consider the map
$f^n-s_n\circ d_P: P^n\rightarrow Q^n$.
$Im(f^n-s_n\circ d_P)\subseteq Ker(d_Q^{n-1})$.

$f^{n-1}\circ d_P=d_Q^{n-1}\circ f^n=d_Q^{n-1}\circ s_n\circ
d_P=f^{n-1}-s_{n-1}\circ d_p)\circ d_p$

So by projectivity of $P^n$ you get 
$$s_{n+1}: P^n\rightarrow Q^{n+1}$$ such that 
$d_Q^n\circ s_{n+1}=f^n-s_n\circ d_p$
\end{proof}
\begin{corr}
$Ext_R^n(A,D)$ is independent of the choice of the projective resolution of $A$.
(up to natural isomorphism))

$A\mapsto Ext^n_R(A,D)$ is a functor.
\end{corr}

Given a short exact sequence. Suppose we can find projective resolutions
$P\com\rightarrow A$,$Q\com\rightarrow B$, $R\com \rightarrow C$ which fit into
a short exact sequence of complexes.
$$ \xymatrix{
0 \ar[r]& A \ar[r]& B \ar[r]& C \ar[r]& 0 \\
0\ar[r] & P\com \ar[u] \ar[r]& Q\com \ar[u] \ar[r]& R\com \ar[u] \ar[r] & 0
}$$

Then on applying $Hom_R(-,D)$, we get

$$
\xymatrix{
& &\ar[d] &\ar[d] &\ar[d] &  \\
0 \ar[r] & Hom_R(R^n,D) \ar[r]\ar[d]  & Hom(Q^n,D) \ar[r] \ar[d]& Hom(P^n,D)
\ar[r] \ar[d]& 0\\
0 \ar[r] & Hom_R(R^{n+1},D) \ar[r]\ar[d] & Hom(Q^{n+1},D) \ar[r] \ar[d]&
Hom(P^{n+1},D) \ar[r] \ar[d]& 0\\
& & & & & }$$
 where exach row is exact. Then we get a long exact sequence of cohomology
 groups which are nothing but $Ext_R^n(-,D)$.
 
 \begin{lemma}
 Given 
 
 $$
 \xymatrix{
 0 \ar[r] & A\ar[r] & B \ar[r]& C \ar[r]& 0\\
 & P\com \ar[u]& & R\com \ar[u]
 }
 $$
 Set $Q^n=P^n\oplus R^n$. Then we have
 $$
 \xymatrix{
 0 \ar[r] & A \ar[r] & B \ar[r]& C \ar[r] & 0\\
 & 0 &  P^0 \ar[u]^{\epsilon_A} & Q^0 \ar@{.>}^{\exists \epsilon_B} & R^0
 \ar@{.>}[ul]^{\stackrel{\sim}{\epsilon_C}} \ar[u]^{\epsilon_C} & 0\\
 &0 &  P' \ar[u]& Q'\ar@{.>}[u]^{\exists d_Q^0}& R' \ar[u] & 0 }
 $$
 \end{lemma}
 \begin{proof}
 Set 
 $\epsilon_B(P,r)=i \epsilon_A(p)+\stackrel{\sim}{\epsilon}_C(r)$
 Check: $\epsilon_B$ is surjective.
 Now we have 
  \end{proof}